//
//  CampusPersonageTableViewCell.m
//  ChineseCollegeStudentsNetwork
//
//  Created by 刘喆 on 2018/5/27.
//  Copyright © 2018年 刘喆. All rights reserved.
//

#import "CampusPersonageTableViewCell.h"

@implementation CampusPersonageTableViewCell

#pragma mark - Init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createSubviews];
    }
    return self;
}

#pragma mark - Subviews
#pragma amrk layout subviews
- (void)layoutSubviewsInView {
    [_iconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.width.mas_equalTo(kDeviceWidth/3.5);
        make.height.mas_offset(kDeviceWidth/3.5*0.8);
        make.top.mas_offset(12);
    }];
    
    
    [_titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(10);
        make.left.mas_equalTo(kDeviceWidth/3.5 + 20);
        make.width.mas_equalTo(kDeviceWidth/3*2-40);
        make.height.mas_offset(14);
    }];
    
    [_timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLbl.mas_bottom).offset(5);
        make.left.mas_equalTo(kDeviceWidth/3.5 + 20);
        make.width.mas_equalTo(kDeviceWidth/3.5*2 -40);
        make.height.mas_offset(10);
    }];
    [_contextLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.timeLbl.mas_bottom);
        make.left.mas_equalTo(kDeviceWidth/3.5 + 20);
        make.right.mas_equalTo(-12);
        make.bottom.mas_equalTo(-10);
    }];
}

#pragma mark create subviews
- (void)createSubviews {
    [self.contentView addSubview:self.iconImgv];
    [self.contentView addSubview:self.titleLbl];
    [self.contentView addSubview:self.timeLbl];
    [self.contentView addSubview:self.contextLbl];
    
    [self layoutSubviewsInView];
}

- (UIImageView *)iconImgv {
    if (!_iconImgv) {
        _iconImgv = [[UIImageView alloc] init];        
    }
    return _iconImgv;
}

- (UILabel *)titleLbl {
    if (!_titleLbl) {
        _titleLbl = [[UILabel alloc] init];
        _titleLbl.textColor = kRGB(153, 153, 153, 1);
        _titleLbl.font = [UIFont systemFontOfSize:14];

    }
    return _titleLbl;
}

- (UILabel *)timeLbl {
    if (!_timeLbl) {
        _timeLbl = [[UILabel alloc] init];
        _timeLbl.textColor = kRGB(153, 153, 153, 1);
        _timeLbl.font = [UIFont systemFontOfSize:10];
    }
    return _timeLbl;
    
}

- (UILabel *)contextLbl {
    
    if (!_contextLbl) {
        _contextLbl = [[UILabel alloc] init];
        _contextLbl.textColor = kRGB(153, 153, 153, 1);
        _contextLbl.font = [UIFont systemFontOfSize:14];
        _contextLbl.numberOfLines = 3;
    }
    return _contextLbl;
    
}

@end
